package com.poptap.base.domain;

import java.util.Date;

import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

@Document
public class User extends BaseEntity {

	private static final long serialVersionUID = 8529576047653757513L;

	/**
	 * 如果是手机注册，则用countryCode+tel作为登录账号，如果是email，作以email为登录账号
	 */
	private String countryCode;
	
	private String tel;
	
	private String email;
	
	/**
	 * user是否有效，主要是用于验证买家的userName是否为telephone number or email
	 */
	private boolean isValid;
	
	/**
	 * 用户固定密码
	 */
	private String password;
	
	/**
	 * 以第一次创建并登录成功时才设为有效的用户，否则为非法用户
	 */
	private boolean isEffective;
	
	/**
	 * 用户登录随机码
	 */
	private String randomCode;
	
	/**
	 * 用户本次登录随机码超时时间，超时需要重新获取随机码或直接用密码进行登录
	 */
	private Date activeTime;
	
	@DBRef
	private Company company;
	
	private UserType type;

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isEffective() {
		return isEffective;
	}

	public void setEffective(boolean isEffective) {
		this.isEffective = isEffective;
	}

	public String getRandomCode() {
		return randomCode;
	}

	public void setRandomCode(String randomCode) {
		this.randomCode = randomCode;
	}

	public Date getActiveTime() {
		return activeTime;
	}

	public void setActiveTime(Date activeTime) {
		this.activeTime = activeTime;
	}

	public boolean isValid() {
		return isValid;
	}

	public void setValid(boolean isValid) {
		this.isValid = isValid;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public String getCountryCode() {
		return countryCode;
	}

	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}

	public UserType getType() {
		return type;
	}

	public void setType(UserType type) {
		this.type = type;
	}
}
